/**
 * @author gao
 * @date 2025/11/2 16:08
 */

// 无返回值无参数
@FunctionalInterface
interface NoParameterNoReturn {
    void test();
}

// 无返回值一个参数
@FunctionalInterface
interface OneParameterNoReturn {
    void test(int a);
}

// 无返回值多个参数
@FunctionalInterface
interface MoreParameterNoReturn {
    void test(int a, int b);
}

// 有返回值无参数
@FunctionalInterface
interface NoParameterReturn {
    int test();
}

// 有返回值一个参数
@FunctionalInterface
interface OneParameterReturn {
    int test(int a);
}

// 有返回值多参数
@FunctionalInterface
interface MoreParameterReturn {
    int test(int a, int b);
}

public class Demo1 {
    public static void main(String[] args) {
        NoParameterNoReturn noParameterNoReturn = () -> System.out.println("无参数无返回值");
        noParameterNoReturn.test();

        OneParameterNoReturn oneParameterNoReturn = (int a) -> System.out.println("一个参数无返回值");
        oneParameterNoReturn.test(1);

        MoreParameterNoReturn moreParameterNoReturn = (int a, int b) -> System.out.println("多个参数无返回值");
        moreParameterNoReturn.test(1, 2);

        NoParameterReturn noParameterReturn = () -> 10;
        System.out.println(noParameterReturn.test());

        OneParameterReturn oneParameterReturn = (int x) -> x * 2;
        System.out.println(oneParameterReturn.test(10));

        MoreParameterReturn moreParameterReturn = (int a, int b) -> a + b;
        System.out.println(moreParameterReturn.test(1, 2));
    }
}